// <copyright file="DummyDataTableHandler.cs" company="YUIAsp.Net">
// Copyright (c) 2009 All Right Reserved
// </copyright>
// <author>raul popescu</author>
// <email>dev@yuiasp.net</email>
// <date>2009-01-30</date>
// <summary>YUIAsp.Net File</summary>

using YUIAspNet;

namespace YUIAspNetDemo.DataTable
{
    public class DummyDataTableHandler : BaseDataTableHandler
    {
        public override DataSourceBase PopulateData()
        {
            LocalDataSource tbl = new LocalDataSource();

            tbl.AddColumn("id");
            tbl.AddColumn("name");

            for (int i = StartIndex; i < (StartIndex + ResultsPerPage); i++)
                tbl.AddRow(i.ToString(), "name " + i);

            tbl.AddSetting("totalRecords", GetVirtualItemsCount());
            tbl.AddSetting("recordsReturned", tbl.Count);
tbl.AddSetting("startIndex", StartIndex);
            tbl.AddSetting("sort", SortColumnKey);
            tbl.AddSetting("pageSize", ResultsPerPage);
            //context.Response.Write(string.Format("{{'recordsReturned':{0},'totalRecords':{1},'startIndex':{2},'sort':'{3}','dir':'{4}','pageSize':{5},'records': ", src.Rows.Count, virtualItemsCount,this.StartIndex, this.SortColumnKey, this.SortDirection, this.ResultsPerPage));
           

            return tbl;
        }

        public int GetVirtualItemsCount()
        {
            return 1000;
        }
    }
}
